package org.ouwh.oowiki.http;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.HandlerWrapper;

public class UriAccessHandler extends HandlerWrapper {
	PathMap uriMap = new PathMap();

	/**
     */
	public UriAccessHandler() {
	}

	/**
     */
	@Override
	public void handle(String target, Request baseRequest,
			HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		if (baseRequest.getPathInfo().toUpperCase().startsWith("/WEB-INF/")) {
			response.sendError(HttpStatus.FORBIDDEN_403);
			baseRequest.setHandled(true);
			return;
		}

		getHandler().handle(target, baseRequest, request, response);
	}
}
